
********************************************************************************

use DTA/Datos_ENIA_95_07_Processed, clear

********************************************************************************
graph drop _all

hist totmuj if abs(totmuj-20)<= 8, discrete xline(19.5, lcolor(navy8)) title("All Firms") freq ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_all, replace)
sum totmuj if abs(totmuj-20)<= 8
graph export GRAPHS/Total.pdf, replace

hist totmuj if abs(totmuj-20)<= 8 & period==1, discrete xline(19.5, lcolor(navy8)) freq title("1995 - 1998") ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_p1, replace)
hist totmuj if abs(totmuj-20)<= 8 & period==2, discrete xline(19.5, lcolor(navy8)) freq title("1999 - 2002") ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_p2, replace)
hist totmuj if abs(totmuj-20)<= 8 & period==3, discrete xline(19.5, lcolor(navy8)) freq title("2003 - 2007") ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_p3, replace)
graph combine Histogram_p1 Histogram_p2 Histogram_p3, row(1)
graph export GRAPHS/Histogram-periods.pdf, replace
sum totmuj if abs(totmuj-20)<= 8 & period==1
sum totmuj if abs(totmuj-20)<= 8 & period==2
sum totmuj if abs(totmuj-20)<= 8 & period==3

hist totmuj if abs(totmuj-20)<= 8 & sectorA==1, discrete xline(19.5, lcolor(navy8)) freq title("Sectors High W/M") ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_secA, replace)
hist totmuj if abs(totmuj-20)<= 8 & sectorB==1, discrete xline(19.5, lcolor(navy8)) freq title("Sectors Low W/M") ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_secB, replace)
graph combine Histogram_secA Histogram_secB, row(1)
graph export GRAPHS/Histogram-sectors.pdf, replace
sum totmuj if abs(totmuj-20)<= 8 & sectorA==1
sum totmuj if abs(totmuj-20)<=8 & sectorB==1

hist totmuj if abs(totmuj-20)<= 8 & small==1, discrete xline(19.5, lcolor(navy8)) title("Small Firms") freq ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_small, replace)
hist totmuj if abs(totmuj-20)<= 8 & large==1, discrete xline(19.5, lcolor(navy8)) title("Large Firms") freq ytitle("Frequency") xtitle("Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_large, replace)
graph combine Histogram_small Histogram_large, row(1)
graph export GRAPHS/Histogram-bysize.pdf, replace
sum totmuj if abs(totmuj-20)<= 8 & small==1
sum totmuj if abs(totmuj-20)<= 8 & large==1

xtset nui year
gen above = totmuj > 20
gen change = above - L.above
replace change = 1 if change == -1
bysort nui: gen switch = sum(change)
replace switch = . if change == .
gen ever_switch = switch > 0 if switch != .
hist totmuj if abs(totmuj-20)<= 8 & ever_switch==1, discrete xline(19.5, lcolor(navy8)) title("Switchers") freq ytitle("Frequency") xtitle("Number of Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_switch, replace)
hist totmuj if abs(totmuj-20)<= 8 & ever_switch==0, discrete xline(19.5, lcolor(navy8)) title("Non-Switchers") freq ytitle("Frequency") xtitle("Number of Women Employees per Firm") fcolor(navy8) graphregion(color(white)) name(Histogram_noswitch, replace)
graph combine Histogram_switch Histogram_noswitch, row(1)
graph export GRAPHS/Histogram-byswitch.pdf, replace
sum totmuj if abs(totmuj-20)<= 8 & ever_switch==1
sum totmuj if abs(totmuj-20)<= 8 & ever_switch==0
graph drop _all


********************************************************************************
